--[[
敏感字过滤
--]]

local ac = require "ahocorasick"
local dict = {"string1", "string","fuck", "etc", "操", "他妈的"}
local acinst, a = ac.create(dict)
print("acinst:", acinst, a)
local s = '就是123他妈的2string32141etc##########fuck'
print(type(acinst))
--local r,h = ac.match(acinst, s)
--
--if r then
--    print(r,h)
--    print(string.sub(s, r+1,h+1))
--end

repeat
    local i, j = ac.match(acinst, s)
    if i and j then
        s = ("%s%s%s"):format(s:sub(1, i), "*", s:sub(j + 2))
    end
until not (i and j)

print(s)